/******************************************************************************
 * SVN­Version­Information:
 * ­­­­­­­­­­­­­­­­­­­­­­­­---------------------
 * $LastChangedRevision: 6 $
 * $LastChangedBy: c.a.duevel $
 * $LastChangedDate: 2009-08-26 15:12:37 +0000 (Wed, 26 Aug 2009) $
 * $HeadURL: http://robofight.googlecode.com/svn/trunk/Server/test/de/hft_stuttgart/botwar/server/system/Helpers.java $
 *******************************************************************************/
package de.hft_stuttgart.botwar.server.system;
import de.hft_stuttgart.botwar.server.Main;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

/**
 *
 * @author c.a.duevel@gmail.com
 */
public class Helpers {
    static final String PORT = "5487";
    static final String LOGIN_URL = "rmi://127.0.0.1:"+PORT+"/login";
        static final String CONF_DIR = System.getProperty("user.home") +
            System.getProperty("file.separator") + "confDir";
    static final String standardArgs[] = {"-drop","-host","127.0.0.1","-port",
    PORT,"-noSecurity","-confDir",CONF_DIR};

    static void startServer(final String ... params) throws InterruptedException {
        Runnable r = new Runnable() {
            public void run() {
                Main.main(params);
            }
        };
        Thread t = new Thread(r);
        t.start();
        while (!Main.isStarted()) {
            Thread.sleep(50);
        }
    }

    static void stopServer() throws RemoteException, NotBoundException, InterruptedException {
        Main.shutDown();
        Thread.sleep(50);
    }

}